﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Srvtools;

public partial class Template_WMasterDetail5 : System.Web.UI.Page
{
    private Srvtools.WebDataSet WMaster;

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            InitializeComponent();
            Master.DataSource = WMaster;
            Detail1.DataSource = WMaster;
            Detail2.DataSource = WMaster;
        }
    }

    private void InitializeComponent()
    {
        System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Template_WMasterDetail5));
        this.WMaster = new Srvtools.WebDataSet();
        ((System.ComponentModel.ISupportInitialize)(this.WMaster)).BeginInit();
        // 
        // WMaster
        // 
        this.WMaster.Active = false;
        this.WMaster.AlwaysClose = false;
        this.WMaster.DeleteIncomplete = true;
        this.WMaster.Guid = "3cfb9c47-87cb-4493-ae85-f4b6932e3f30";
        this.WMaster.LastKeyValues = null;
        this.WMaster.Locale = new System.Globalization.CultureInfo("zh-TW");
        this.WMaster.PacketRecords = 100;
        this.WMaster.Position = -1;
        this.WMaster.RemoteName = null;
        this.WMaster.ServerModify = false;
        ((System.ComponentModel.ISupportInitialize)(this.WMaster)).EndInit();

    }
    protected void WebNavigator1_Command(object sender, CommandEventArgs e)
    {
        if (e.CommandName == "cmdFirst" || e.CommandName == "cmdPrevious"
            || e.CommandName == "cmdNext" || e.CommandName == "cmdLast")
        {
            Detail1.ExecuteSelect(wfvMaster);
            Detail2.ExecuteSelect(wfvMaster);
            DataBind();
        }
        else if (e.CommandName == "cmdAdd")
        {
            Detail1.ExecuteAdd(wfvMaster);
            Detail2.ExecuteAdd(wfvMaster);
            DataBind();
        }
        else if ((e.CommandName == "cmdDelete" || e.CommandName == "cmdApply" || e.CommandName == "cmdOK")
            && (sender as WebNavigator).State != WebNavigator.NavigatorState.ApplyFail)
        {
            Detail1.ExecuteSelect(wfvMaster);
            Detail2.ExecuteSelect(wfvMaster);
            DataBind();
        }
    }
    protected void wfvMaster_AfterInsertLocate(object sender, EventArgs e)
    {
        Detail1.ExecuteSelect(wfvMaster);
        Detail2.ExecuteSelect(wfvMaster);
        DataBind();
    }
    protected void wfvMaster_PageIndexChanged(object sender, EventArgs e)
    {
        Detail1.ExecuteSelect(wfvMaster);
        Detail2.ExecuteSelect(wfvMaster);
        DataBind();
    }
    protected void wfvMaster_Canceled(object sender, EventArgs e)
    {
        Detail1.ExecuteSelect(wfvMaster);
        Detail2.ExecuteSelect(wfvMaster);
        DataBind();
    }
}
